#include "configs.h"
#include "file_op.h"
#include <cJSON.h>

static cJSON *configs = NULL;
static cJSON *timers = NULL;

void configs_init(void)
{
    int ret;
    char buf[2048];

    memset(buf, 0, 2048);
    ret = read_file(CONFIGS_FILE, buf, 2048);
    if (ret > 0) {
        configs = cJSON_Parse(buf);
        // cJSON *ssid = cJSON_GetObjectItem(respJson, "ssid");
        // cJSON *password = cJSON_GetObjectItem(respJson, "password");
        // printf("ssid: %s\r\n", ssid->valuestring);
        // printf("password: %s\r\n", password->valuestring);
        // set_sta(ssid->valuestring, password->valuestring);
    }

    memset(buf, 0, 2048);
    ret = read_file(TIMERS_FILE, buf, 2048);
    if (ret > 0) {
        timers = cJSON_Parse(buf);
    }
}